﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WebShop.DataSource;
using WebShop.Models;

namespace WebShop.Services
{
    public class PerfumesService
    {
        public List<ProductModel> GetAllPerfumes()
        {
            using (WebShopEntities context = new WebShopEntities())
            {
                var perfumes = context.Products.Select(item => new ProductModel
                {
                    Id=item.Id,
                    Name = item.Name,
                    Price = item.Price,
                    SubcategoryId = item.FK_Subcategory,
                    //CategoryId = item.Subcategories.FK_Category
                }).ToList();

                return perfumes;
            }
        }
    }
}